import path from "path";
import CONFIG from "./config";
import parseVue2 from "./vue2";

const logger = (text: string, type: "log" | "info" | "warn" | "error") => {
  console[type](text);
};
const filePath = path.resolve(__dirname, "../test/index.vue");
parseVue2({ filePath, CONFIG, logger });

// let str = `
// hello 哈哈{{ add("李四a") }}呵呵呵 {{ add("王五") }}
// `;
// const strList: string[] = [];
// while (str.length) {
//   const matched = [...str.matchAll(/\{\{[\s\S]+?\}\}/g)];
//   if (matched.length === 0) {
//     strList.push(str);
//     break;
//   }
//   const match = matched?.[0];
//   if (match && match[0]) {
//     const prev = str.slice(0, match.index);
//     if (prev) {
//       strList.push(prev);
//     }
//     strList.push(match[0]);
//     str = str.slice(match.index + match[0].length);
//   }
// }

// console.log("🚀 ~ strList:", strList);
